package com.automannn.seataSamples.account.controller;

import com.automannn.seataSamples.account.service.IAccountService;
import com.automannn.seataSamples.api.dto.AccountDTO;
import com.automannn.seataSamples.api.response.ObjectResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author automannn
 * @Date 2022/3/24
 */
@RestController
@RequestMapping("/account")
@Slf4j
public class AccountController {
    @Autowired
    private IAccountService accountService;

    @PostMapping("/dec_account")
    ObjectResponse decreaseAccount(@RequestBody AccountDTO accountDTO) {
        log.info("扣除账户：{}", accountDTO.toString());
        return accountService.decreaseAccount(accountDTO);
    }
}
